
export default {
  data() {
    return {
      CardList: {
        datalist: [],
        details: [],
        publicaddBaseList: [],
      }
    }
  },
  methods: {
    /**
   *
   * 通过id获取,此ID下前方是否有值
   * @param id 将要判断的ID
   * @returns 若有则返回obj 若没有返回false
   */
   getFrontEle(id) {
    for (let i = 0; i < this.CardList.datalist.length; i++) {
      // let ele = (this.CardList.datalist as any)[i].list;
      // for (let j = 0; j < ele.length; j++) {
      //   if ((ele[j] as any).id === id && i !== 0) {
      //     if (i - 1 < 0) {
      //       return false;
      //     }
      //     return this.CardList.datalist[i - 1];
      //   }
      // }
      // 解决联动任务详情下一个bug
      let ele = this.CardList.datalist[i].activeObject;
      if (ele.id === id && i !== 0) {
        if (i - 1 < 0) {
          return false;
        }
        return this.CardList.datalist[i - 1];
      }
    }
    return false;
  },
  /**
   *
   * 通过id获取,此ID下后方方是否有值
   * @param id 将要判断的ID
   * @returns 若有则返回obj 若没有返回false
   */
 getBehindEle(id){
    // console.log("datalist是：",this.datalist.length)

    for (let i = 0; i < this.CardList.datalist.length; i++) {
      let ele = this.CardList.datalist[i].activeObject;
      if (ele.id === id && i !== this.CardList.datalist.length - 1) {
        return this.CardList.datalist[i + 1];
      }
      // for (let j = 0; j < ele.length; j++) {
      //   if ((ele[j] as any).id === id && i !== this.CardList.datalist.length - 1) {
      //     return this.CardList.datalist[i + 1];
      //   }
      // }
    }
    return false;
  }
  }
}
